<?php

	/**
	* Save top sentence
	* for project Kurtulus Law
	* @author trungdt
	* @since Dec 2
	* @copyright Absoft Viet Nam
	*/
	if (!defined('EXPONENT')) exit('');

	if (exponent_users_isAdmin())
	{
        $id="";
        if (isset($_REQUEST['id']))
        {
            $id=_to_vietnamese_with_nomark($_REQUEST['id']);
        }
        $top = $db->selectObject('site_topsentence',"ref_location = '{$id}'");
        
        $top->ref_location=$id;
        $top->title=$_REQUEST['title'];
        $top->content=$_REQUEST['content'];
		
        if (isset($top->id))
            $db->updateObject($top,"site_topsentence");
        else
            $db->insertObject($top,"site_topsentence");
		
        exponent_flow_redirect();
	} else {
		echo SITE_403_HTML;
	}
    
	exponent_flow_redirect();
?>